export default url => {
    const crud = window.$crud(url)


    const getColNameList = (code) => window.$axios({
        url:`${url}/${code}/colnames`,
        method: 'get'
    })

    const getColNameListBySql = (params) => window.$axios({
        url:`${url}/sql/colnames`,
        method: 'post',
        params
    })
    
    const getDataList = (code) => window.$axios({
        url:`${url}/${code}/list`,
        method: 'get'
    })

        
    const getDataListByParamter = (code,param) => window.$axios({
        url:`${url}/${code}/listbyparam`,
        method: 'get',
        params:{param}
    })
    
    const getDataPage = (code,pagination) => window.$axios({
        url:`${url}/${code}/page`,
        method: 'get',
        params:pagination
    })

    const getViewPageByEntity = (pagination,data) => window.$axios({
        url:`${url}/view/page`,
        method: 'post',
        params:pagination,
        data
    })

    const getDataListByValues = (code,filed,data) => window.$axios({
        url:`${url}/${code}/${filed}/list`,
        method: 'post',
        data
    })

    return {
        ...crud,
        getColNameList,
        getColNameListBySql,
        getDataList,
        getDataListByParamter,
        getDataListByValues,
        getDataPage,
        getViewPageByEntity
    }
}